import request from '@/utils/request';

/**
 *  获取评论列表接口
 * @param {number} aid 稿件id
 * @param {Object} param1 获取条件
 * @param {number} param1.root
 * @param {number} param1.page
 * @param {number} param1.size
 */
export function getReplyListAPI(aid, { root, page, size }) {
    return request({
        url: `/reply/list/${aid}`,
        method: 'GET',
        params: { root, page, size },
    });
}
/**
 * 发布评论
 * @param {number}} aid 稿件id
 * @param {Object} param1 评论数据
 */
export function addReplyAPI(aid, { root, parent, content }) {
    return request({
        url: `/reply/add/${aid}`,
        method: 'POST',
        data: { root, parent, content },
    });
}
/**
 * 删除回复
 * @param {number} rpid 回复id
 */
export function delReplyAPI(rpid) {
    return request({
        url: `/reply/del/${rpid}`,
        method: 'DELETE',
    });
}
/**
 *  稿件互动(点赞, 点踩)
 * @param {number} rpid 评论id
 * @param {number} action 操作类型
 */
export function replyActionAPI(rpid, action) {
    return request({
        url: `/reply/action/${rpid}`,
        method: 'PUT',
        data: { action },
    });
}
